home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / animpg14.zip / AnimPage.cmd < prev    next >
OS/2 REXX Batch file  |  1996-07-13  |  19KB  |  448 lines

  1. /******************  Animation Page Creator v1.3 ***************/
  2.  
  3. '@ECHO OFF'
  4. say ' *****************  Animation Page Creator v1.3 ***************'
  5. say ' ************ by Sallie Krebs (skrebs@inwave.com) ********'
  6.  
  7. /***************** User Variables ************************/
  8. /* IMPORTANT!!!!! If you are running an older version of WebExplorer */
  9. /* which does not support Tables, then set the AnimTables variable to 0 */
  10. AnimTables=1
  11. AnimPath=''
  12. /*  AnimPath is the base directory for your animation files. Each
  13.     separate animation must be located in its own subdirectory
  14.     beneath the base directory. Also, there should be NO directories
  15.     other than animations beneath the base directory. If this variable
  16.     is blank, then the current directory will be used for the AnimPath
  17.     variable. (This assumes that animpage.cmd is run from the base
  18.     directory.)
  19.     Example:    Animpath='c:\inet\animate'                   */
  20. AnimBackground='bkgdos2.gif'    /* Background graphic */
  21. AnimHeader='header.gif'         /* Header graphic for top of page */
  22. AnimArc='animarc.gif'           /* 'Animation Archive' header graphic- near */
  23.                                 /* the bottom of the page. */
  24.                                 /* Under the Animation Archive graphic will */
  25.                                 /* be a list of up to 5 sites you can link */
  26.                                 /* to. Enter the link and title info below. */
  27.                                 /* Leave blank (ie: '') otherwise. */
  28. AnimArcHRef1='http://www.os2forum.or.at/TeamOS2/English/Special/Animations/'
  29. AnimArcTitle1='OS/2 Information Center - Animations'
  30. AnimArcHRef2='http://www.kuwait.net/~morpheus/web-anim.html'
  31. AnimArcTitle2='WebExplorer Animations Archive'
  32. AnimArcHRef3='http://eev11.e-technik.uni-erlangen.de/animationen.html'
  33. AnimArcTitle3='Animation HomePage'
  34. AnimArcHRef4=''
  35. AnimArcTitle4=''
  36. AnimArcHRef5=''
  37. AnimArcTitle5=''
  38. AnimRdButton='rd_pin.gif'       /* Graphic for the AnimArcHRef lines */
  39. AnimDivider='divider.gif'       /* Divider graphic. For link to top of page */
  40. AnimLogo='merlin.gif'           /* Building for Merlin logo graphic for bottom of page */
  41. AnimLogoHRef='http://www.in.net/~mcdonajp/bfos2m.htm'
  42. AnimRibbon='blueribn.gif'       /* Blue Ribbon Logo graphic for bottom of page */
  43. AnimRibbonHRef='http://www.eff.org/blueribbon.html'
  44.                                 /* Blue Ribbon Logo HREF for Blue Ribbon logo */
  45. AnimOnward='everonwd.gif'       /* Ever Onward Logo graphic for bottom of page */
  46. AnimOnwardHRef='http://www.aescon.com/innoval/everos2/'
  47. /* the above graphics files should be located in the AnimPath directory.
  48.    You can substitute your own graphics for the above by copying your
  49.    files to the 'AnimPath' directory. You can then either delete the files
  50.    included with AnimPage.cmd and rename your files as above, or edit the
  51.    above variables to correspond to the filenames of your graphics. */
  52. /************** End of User Variables ********************/
  53.  
  54. signal on error name DIE
  55. signal on failure name DIE
  56. signal on halt name DIE
  57. signal on syntax name DIE
  58.  
  59. /****** required REXXUTIL initialization ******/
  60. rc = RxFuncAdd(SysLoadFuncs, REXXUTIL, SysLoadFuncs)
  61. if rc \= 0 then do
  62.     say 'Could not load RexxUtil functions. Exiting.'
  63.     exit
  64. end
  65. call SysLoadFuncs
  66.  
  67. say '********************* NOTE ******************************'
  68. say '*** You must edit the user variables at the start of  ***'
  69. say '*** this file before running this program.            ***'
  70. say ''
  71.  
  72. address CMD
  73.  
  74. /*  I wanted to use the following statement, but for some reason it no
  75.     longer works?!?!?! Yet another Fixpack 17 bug, er... feature?!?!? */
  76. /* if RxMessageBox('Run AnimPage Now?',, 'YESNO', 'QUERY') = 7 */
  77.  
  78. /* I'll have to settle for: */
  79. 'pause Press Ctrl-C to abort now, or any other key to continue'
  80. say ''
  81.  
  82. fspec = AnimPath
  83. if fspec == '' then
  84.     fspec = directory()||'\'
  85. if (lastpos('\', fspec) \= length(fspec)) then
  86.     fspec = fspec||'\'
  87. AnimPath = fspec
  88.  
  89. /* Make AnimPage.BAK file */
  90. found. = 0
  91. AnimFspec = fspec||AnimPage.htm
  92. rc = SysFileTree(AnimFspec, 'found', 'F')
  93. if found.0 \= 0 then do
  94.     ofspec = left(AnimFspec, length(AnimFspec) - 3) || 'BAK'
  95.     say 'Copying AnimPage.htm to AnimPage.bak'
  96.     'copy 'AnimFspec' 'ofspec
  97.     say ''
  98.     say 'Deleting old AnimPage.htm'
  99.     'del 'AnimFspec
  100.     say ''
  101. end
  102.  
  103. /* find subdirectories */
  104. AnimDirs. = 0
  105. rc = SysFileTree(fspec, 'AnimDirs', 'SDO')
  106. if (rc \= 0)|(AnimDirs.0 == 0) then do
  107.     say 'Error reading animation subdirectories. Exiting.'
  108.     call SysDropFuncs
  109.     exit
  110. end
  111.  
  112. do x = 1 to AnimDirs.0     /* check each subdirectory: */
  113.     AnimFiles. = 0
  114.     fspec = AnimDirs.x||'\*.gif'
  115.     rc = SysFileTree(fspec, 'AnimFiles', 'FO')
  116.     if AnimFiles.0 == 0 then do
  117.         fspec = AnimDirs.x||'\*.jpg'
  118.         rc = SysFileTree(fspec, 'AnimFiles', 'FO')
  119.         if AnimFiles.0 == 0 then do
  120.             fspec = AnimDirs.x||'\*.bmp'
  121.             rc = SysFileTree(fspec, 'AnimFiles', 'FO')
  122.             if AnimFiles.0 == 0 then do
  123.                 say 'Could not locate any animations. Exiting.'
  124.                 call SysDropFuncs
  125.                 exit
  126.             end
  127.         end
  128.     end
  129. end
  130.  
  131. /* do html header */
  132. call stream AnimFspec, 'c', 'open write'
  133.  
  134. top = '<IMG src="file:///'||AnimPath||AnimHeader'" alt="[AnimPage]">'
  135.  
  136. call lineout AnimFspec, '<HTML>'
  137. call lineout AnimFspec, ''
  138. call lineout AnimFspec, '<HEAD>'
  139. call lineout AnimFspec, '<TITLE>WebExplorer Animations</TITLE>'
  140. call lineout AnimFspec, '<body background="file:///'||AnimPath||AnimBackground'">'
  141. call lineout AnimFspec, '</HEAD>'
  142. call lineout AnimFspec, ''
  143.  
  144. call lineout AnimFspec, '<CENTER>'
  145. call lineout AnimFspec, '<A NAME="top"><B>WebExplorer Animations</B></A>'
  146. call lineout AnimFspec, '</CENTER><P>'
  147. call lineout AnimFspec, '<CENTER>'
  148. call lineout AnimFspec, top
  149. call lineout AnimFspec, '</CENTER><P>'
  150. call lineout AnimFspec, ''
  151. call lineout AnimFspec, '<BODY>'
  152. call lineout AnimFspec, ''
  153. if (AnimTables) then do
  154.     call lineout AnimFspec, '<CENTER>'
  155.     call lineout AnimFspec, '<TABLE BORDER=3>'
  156.     call lineout AnimFspec, '<TR>'
  157.     call lineout AnimFspec, '<TH ALIGN="center" VALIGN="middle" NOWRAP>Picture</TH><TH ALIGN="center" VALIGN="middle" NOWRAP>Title</TH><TH ALIGN="center" VALIGN="middle" NOWRAP>Author</TH><TH ALIGN="center" VALIGN="middle" NOWRAP>Size</TH>'
  158.     call lineout AnimFspec, '</TR>'
  159. end
  160. else
  161.     call lineout AnimFspec, '<ul>'
  162.  
  163. /* get animation subdirectories info: */
  164. ADir. = 0
  165. do x = 1 to AnimDirs.0
  166.     ai = 0
  167.     ad = x
  168.     ADir.0 = x              /* number of animation subdirectories */
  169.     ADir.ad.ai = 0          /* init number of anim files in subdir */
  170.     AnimFiles. = 0
  171.     fspec = AnimDirs.x||'\*.gif'
  172.     afext = '.gif'                  /* anim file extension */
  173.     rc = SysFileTree(fspec, 'AnimFiles', 'FO')
  174.     if AnimFiles.0 == 0 then do
  175.         fspec = AnimDirs.x||'\*.jpg'
  176.         afext = '.jpg'          /* anim file extension */
  177.         rc = SysFileTree(fspec, 'AnimFiles', 'FO')
  178.         if AnimFiles.0 == 0 then do
  179.             fspec = AnimDirs.x||'\*.bmp'
  180.             afext = '.bmp'  /* anim file extension */
  181.             rc = SysFileTree(fspec, 'AnimFiles', 'FO')
  182.         end
  183.     end
  184.  
  185.     ADir.ad.ai = AnimFiles.0
  186.     do f = 1 to AnimFiles.0
  187.         Adir.ad.f = AnimFiles.f
  188.     end
  189.  
  190.     ADir.ad.icon = AnimFiles.1  /* icon for main page is first anim file */
  191.     attl = AnimFiles.1          /* get just the subdirectory name ... */
  192.     apath = filespec('P', attl) /* to use for other variables */
  193.     attl = substr(apath, 1, (length(apath) - 1))
  194.     epos = lastpos('\', attl) + 1
  195.     attl = substr(attl, epos)
  196.     ADir.ad.title = attl
  197.     fname = attl||'.htm'        /* append .htm for loader filename */
  198.     ADir.ad.ahtm = fname        /* name for individual anim loader files */
  199.     ADir.ad.aname = attl        /* subdir name only for NAME tag and ...*/
  200.     alitxt = attl               /* default text for animation list items */
  201.     attl = '<TITLE>'||attl||'</TITLE>'  /* default title fo